home *** CD-ROM | disk | FTP | other *** search
- { Text Menu }
-
- uses Txt;
-
- type MenuType=record
- LenX,LenY,PosX,P:integer;
- Name:string[10];
- end;
- const
- SubNum=4;
- MenuP:integer=1; { Text,Select,Border }
- MenuColor:array[1..3] of byte=($3E,$1F,$31);
- Sub:array[1..SubNum] of MenuType=(
- (LenX:13;LenY:8;PosX: 5;P:1;Name:'Menu-1'),
- (LenX:13;LenY:8;PosX:15;P:1;Name:'Menu-2'),
- (LenX:13;LenY:8;PosX:25;P:1;Name:'Menu-3'),
- (LenX:13;LenY:8;PosX:35;P:1;Name:'Menu-4'));
- SubName:array[1..32] of string[13]=(
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys',
- 'Pet Shop Boys','Pet Shop Boys','Pet Shop Boys','Pet Shop Boys');
-
- { ─────────────── SubMenu ─────────────── }
- function SubMenu:integer;
- var Start,I,X,Y,Xi,P,K:integer;
- Buf:pointer;
- begin
- Start:=1; for I:=1 to MenuP-1 do Inc(Start,Sub[I].LenY);
- X:=Sub[MenuP].LenX; Y:=Sub[MenuP].LenY;
- Xi:=Sub[MenuP].PosX; P:=Sub[MenuP].P;
- GetMem(Buf,4000); GetText(Xi-1,2,X+5,Y+3,Buf^);
- TextBox(Xi-1,2,X+4,Y+2,MenuColor[3],1); TextShadow(Xi-1,2,X+4,Y+2);
- for I:=1 to Y do PrintText(Xi,I+2,MenuColor[1],' '+SubName[Start+I-1]+' ');
- repeat
- PrintText(Xi,P+2,MenuColor[2],' '+SubName[Start+P-1]+' ');
- K:=Key;
- PrintText(Xi,P+2,MenuColor[1],' '+SubName[Start+P-1]+' ');
- case K of
- $4800:Dec(P); $5000:Inc(P); { Up, Down }
- end;
- if P<1 then P:=Y; if P>Y then P:=1;
- until (K=$4B00) or (K=$4D00) or (K=$1C0D) or (K=$011B);
- Sub[MenuP].P:=P;
- PutText(Xi-1,2,X+5,Y+3,Buf^); FreeMem(Buf,4000);
- SubMenu:=K;
- end;
- { ─────────────── MainMenu ─────────────── }
- function MainMenu:integer;
- var Start,K:integer;
- begin
- Start:=0;
- repeat
- PrintText(Sub[MenuP].PosX-1,1,MenuColor[2],' '+Sub[MenuP].Name+' ');
- case Start of
- 0:begin
- K:=Key;
- if (K=$1C0D) or (K=$5000) then begin K:=SubMenu; Start:=1; end;
- end;
- 1:begin
- K:=SubMenu; { Uncomment if wnat to return to MainMenu }
- { if (K=$1C0D) or (K=$011B) then begin Start:=0; K:=0; end; }
- end;
- end;
- PrintText(Sub[MenuP].PosX-1,1,MenuColor[1],' '+Sub[MenuP].Name+' ');
- case K of
- $4B00:Dec(MenuP); $4D00:Inc(MenuP); { Left, Right }
- end;
- if MenuP<1 then MenuP:=SubNum; if MenuP>SubNum then MenuP:=1;
- until (K=$1C0D) or (K=$011B);
- MainMenu:=0;
- if K=$1C0D then begin
- Start:=0; for K:=1 to MenuP-1 do Inc(Start,Sub[K].LenY);
- MainMenu:=Start+Sub[MenuP].P;
- end;
- end;
- { ─────────────── Screen ─────────────── }
- procedure Screen;
- var I:integer;
- begin
- TextBar(1, 1,80, 1,MenuColor[1],' ');
- TextBar(1, 2,80,23,$10,' ');
- TextBar(1,25,80, 1,MenuColor[1],' ');
- for I:=1 to SubNum do PrintText(Sub[I].PosX,1,MenuColor[1],Sub[I].Name);
- PrintText(5,25,MenuColor[1],'Text Menu');
- TextBox(1,2,80,23,$1F,2);
- end;
-
- begin
- Screen;
- PrintNum(40,12,$2F,MainMenu);
- end.
-